package com.studio.dao.impl;

import java.util.List;

import com.studio.base.dao.BaseDao;
import com.studio.base.utils.Pager;
import com.studio.dao.CommonDao;
import com.studio.entity.Users;

public class CommonDaoImpl extends BaseDao implements CommonDao {

	@Override
	public Pager find(Pager pager) {
		return findPageByCriteria(pager.getPageNo(), pager.getPageSize(), new Users());
	}

	@Override
	public List<?> findAllTables() {
		return getHibernateTemplate().find("from Tables");
	}

	@Override
	public List<?> find(String tbName,int pageNo,int pageSize) {
		return this.getSession().createQuery("from "+tbName).setFirstResult(pageNo*(pageSize+1)).setMaxResults(pageSize*(pageNo+1)).list();
	}

}
